import request from '@/utils/request.js'

export const httpRequestLogin = async (data) => {
  return request({
    url: '/enroll',
    method: 'post',
    data
  }).catch(() => null)
}

export const httpPhoneLogin = async (data) => {
  return request({
    url: '/sms/verification',
    method: 'post',
    data
  }).catch(() => null)
}

export const httpUserInfo =  async () => {
  return request({
    url: '/information',
    method: 'get'
  }).catch(() => null)
}

export const changePassword =  async (data) => {
  return request({
    url: '/amend',
    method: 'post',
    data
  }).catch(() => null)
}

export const changeAvatar =  async (avatar) => {
  return request({
    url: '/avatar/update',
    method: 'post',
    data: {avatar}
  }).catch(() => null)
}

export const httpSubmitFeedback = (data) => {
  return request({
    url: '/feedback/add',
    method: 'post',
    data
  })
}

export const httpSendSms = (data) => {
  return request({
    url: '/api/v1/sms',
    method: 'post',
    data
  })
}

export const httpBindMobile = (data) => {
  return request({
    url: '/sms/bind',
    method: 'post',
    data
  })
}

export const httpGetQrCode = (category) => {
  return request({
    url: '/wechat/qr_code',
    method: 'get',
    params: {category}
  })
}

export const httpGetLoginStatus = (scene_id) => {
  return request({
    url: '/wechat/login_status',
    method: 'get',
    params: {scene_id}
  })
}

export const httpBindOpenId = (data) => {
  return request({
    url: '/wechat/bind',
    method: 'post',
    data
  })
}